#include "GateConnectorMgr.h"
#include "EndianCast.h"

void CGateConnectorMgr::AddConnector( uint32 nRemoteIP, utility::network::gate_connector * conn )
{
    m_GateConnectors[nRemoteIP] = conn;
}

void CGateConnectorMgr::AddConnector( const char * szRemoteIP, utility::network::gate_connector * conn )
{
    uint32 nIP = inet_addr(szRemoteIP);
    AddConnector(nIP, conn);
}

void CGateConnectorMgr::RemoveConnector( uint32 nRemoteIP)
{
    m_GateConnectors.erase(nRemoteIP);
}

utility::network::gate_connector * CGateConnectorMgr::Get( uint32 nRemoteIP )
{
    TGateConnectorContainer::iterator i = m_GateConnectors.find(nRemoteIP);
    if (i != m_GateConnectors.end())
        return i->second;
    return NULL;
}
